#if 0
/*使用linux内核定时器*/
#include "my_timer.h"
#include <linux/timer.h>



struct timer_list *timers;   /* 定义一个定时器*/



void timer_init(int timer_num, my_timer_t *timer) {
    timers = (struct timer_list *)malloc(timer_num * sizeof(struct timer_list));
    for (int i = 0; i < timer_num; i++) {
        timers[i].function = timer[i].timer_isr;
	    timer.data = (unsigned long)timer[i].arg;
        timers[i].expires= jffies + msecs_to_jiffies(timer[i].time_cnt);/* 超时时间 2 秒 */
        init_timer(&timers[i]);
    }
}

void timer_start(int timer_index) {
    add_timer(&timers[timer_index]);
}

void timer_stop(int timer_index) {
    del_timer_sync(&timers[timer_index]);
}

void change_timer(int timer_index, unsigned long expires) {
    mod_timer(&timers[timer_index], expires);
}

#endif